package com.s59.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SnowflakeConfig {
    @Value("${workerId}")
    private long workerId;

    @Value("${dataCenterId}")
    private long dataCenterId;

    @Bean
    public Snowflake snowflake(){
        Snowflake snowflake = new Snowflake(workerId,dataCenterId);
        return snowflake;
    }
}
